<template>
    <mescroll-uni
        ref="mescrollRef"
        @init="mescrollInit"
        :height="height"
        :down="downOption"
        @down="refresh"
        :up="upOption"
        @up="getData">
        <activity-list-item
            v-for="(item, index) in datas"
            :key="index"
            :item="item"
            :tabType="tabType"></activity-list-item>
    </mescroll-uni>
</template>
<script>
import activityListItem from "@/pages_me/components/activity/activity-list-item.vue"
import { getUseractivityDetailPage } from "@/service/api/activity.js"

export default {
    props: {
        height: {
            type: String,
            default: "",
        },
        data: {
            type: Object,
            default: () => {},
        },
        activitys: {
            type: Array,
            default: null,
        },
        tabType: {
            type: Number,
            default: 0,
        },
    },
    components: {
        activityListItem,
    },
    data() {
        return {
            datas: [],
            productList: [],
        }
    },
    mounted() {
        this.$nextTick(() => {
            //#ifndef MP
            this.refresh()
            //#endif
        })
    },
    methods: {
        getData(page) {
            this.activitys = [
                {
                    title: "特价活动",
                    titleLogo:
                        "https://img0.baidu.com/it/u=497854488,1500759332&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=455",
                    pic: "https://img2.baidu.com/it/u=1240682873,3529865841&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    name: "五一主题促销满立减活动",
                    contact: "活动介绍：庆祝五一劳动节全场家具类产品参与满立减活动",
                    status: "进行中",
                    V_UseStartTime: "2023-03-29 09:02:22",
                    V_UseEndTime: "2023-04-30 00:00:00",
                },
                {
                    title: "打折活动",
                    titleLogo:
                        "https://img0.baidu.com/it/u=497854488,1500759332&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=455",
                    pic: "https://img2.baidu.com/it/u=1240682873,3529865841&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    name: "五一主题促销满立减活动",
                    contact: "活动介绍：庆祝五一劳动节全场家具类产品参与满立减活动",
                    status: "即将开始",
                    V_UseStartTime: "2023-03-29 09:02:22",
                    V_UseEndTime: "2023-04-30 00:00:00",
                },
                {
                    title: "特价活动",
                    titleLogo:
                        "https://img0.baidu.com/it/u=497854488,1500759332&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=455",
                    pic: "https://img2.baidu.com/it/u=1240682873,3529865841&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    name: "五一主题促销满立减活动",
                    contact: "活动介绍：庆祝五一劳动节全场家具类产品参与满立减活动",
                    status: "已结束",
                    V_UseStartTime: "2023-03-29 09:02:22",
                    V_UseEndTime: "2023-04-30 00:00:00",
                },
            ]
            if (this.activitys) {
                this.mescroll.endBySize(this.activitys.length, this.activitys.length)
                this.datas = this.datas.concat(this.activitys)
            } else {
                // let param = this.param
                // param.state = this.data.state
                // param.PageIndex = page.num
                // param.PageSize = page.size
                // getUseractivityDetailPage(param).then(res => {
                // 	if (res.Data && res.Data.Data) {
                // 		this.mescroll.endBySize(res.Data.Data.length, res.Data.RecordAmout);
                // 		this.datas = this.datas.concat(res.Data.Data)
                // 	}else{
                // 		this.mescroll.endBySize(0, 0);
                // 	}
                // })
            }
        },
        refresh() {
            this.datas = []
            this.mescroll.resetUpScroll()
        },
    },
}
</script>

<style lang="scss"></style>
